import Vue from 'vue'
import Router from 'vue-router'
import Login from '@/components/Login'
import Register from '@/components/Register'
import Index from '@/components/Index'
import FindPassword from '@/components/FindPassword'
import Message from '@/components/Message'
import Friends from '@/components/Friends'
import InsertFriend from '@/components/InsertFriend'
import Requests from '@/components/Requests'

//解决vue-router 3.0以上 重复路由报错的问题
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
Vue.use(Router)

export default new Router({
  routes: [
    {
      path:'/',
      component: Login
    },
	{
	  path:'/Register',
	  component: Register
	},
	{
	  path:'/Index',
	  component: Index,
	  children:[
		  {
		    path:'/Message/:fid',
		    component: Message
		  },
		  {
		    path:'/Message',
		    component: Message
		  },
		  {
		    path:'/Friends',
		    component: Friends
		  },
		  {
		    path:'/InsertFriend',
		    component: InsertFriend
		  },
		  {
		    path:'/Requests',
		    component: Requests
		  }
	  ]
	},
	{
	  path:'/FindPassword',
	  component: FindPassword
	}
  ]
})